<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>ad_ldap.ad_ldap</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="ad_ldap-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/py-ad-ldap">py-ad-ldap</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="ad_ldap-module.html">Package&nbsp;ad_ldap</a> ::
        Module&nbsp;ad_ldap
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="ad_ldap.ad_ldap-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module ad_ldap</h1><p class="nomargin-top"><span class="codelink"><a href="ad_ldap.ad_ldap-pysrc.html">source&nbsp;code</a></span></p>
<pre class="literalblock">
A module for using ldap to manipulate objects in AD.

This module creates two basic object classes: Domain, and ADObject.

The Domain class is used for every interaction with the Active Directory
service itself, such as creating, modifying, or searching for objects.

The ADObject class represents an object in the directory.  It could be a user,
computer, OU, or any object.  It has an attribute called 'properties' that is a
dict of the properties of the object.  To modify a property, you change it in
the dict and call SetProperties().  Every ADObject has a '_domain_obj' property
that is a link to the Domain object, which will do the actual modifications to
the directory.

User, Computer, Group, and Container all inherit from ADObject, and add some
attributes and methods for convenience.  For example, the User object has
Disable() and Enable() methods for disabling and enabling user accounts, and a
'disabled' property to make it easier to tell if an object has been disabled.


Copyright 2010 Google Inc.

Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

</pre>

<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Classes</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Classes"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="ad_ldap.ad_ldap.Domain-class.html" class="summary-name">Domain</a><br />
      Represents an Active Directory Domain.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="ad_ldap.ad_ldap.ADObject-class.html" class="summary-name">ADObject</a><br />
      A generic AD Object.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="ad_ldap.ad_ldap.User-class.html" class="summary-name">User</a><br />
      An Active Directory user object.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="ad_ldap.ad_ldap.Computer-class.html" class="summary-name">Computer</a><br />
      An Active Directory computer object.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="ad_ldap.ad_ldap.Container-class.html" class="summary-name">Container</a><br />
      An Active Directory CN or OU object.
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a href="ad_ldap.ad_ldap.Group-class.html" class="summary-name">Group</a><br />
      An Active Directory Group object.
    </td>
  </tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="ad_ldap.ad_ldap-module.html#ADTimeToUnix" class="summary-sig-name">ADTimeToUnix</a>(<span class="summary-sig-arg">ad_time</span>)</span><br />
      Converts AD double-wide int format to seconds since the epoch format.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="ad_ldap.ad_ldap-pysrc.html#ADTimeToUnix">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="ad_ldap.ad_ldap-module.html#TextTimeToUnix" class="summary-sig-name">TextTimeToUnix</a>(<span class="summary-sig-arg">text_time</span>)</span><br />
      Converts alternate time format text strings to seconds since the epoch.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="ad_ldap.ad_ldap-pysrc.html#TextTimeToUnix">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="ad_ldap.ad_ldap-module.html#BitmaskBool" class="summary-sig-name">BitmaskBool</a>(<span class="summary-sig-arg">bitmask</span>,
        <span class="summary-sig-arg">value</span>)</span><br />
      Returns True or False depending on whether a particular bit has been set.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="ad_ldap.ad_ldap-pysrc.html#BitmaskBool">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="ad_ldap.ad_ldap-module.html#Escape" class="summary-sig-name">Escape</a>(<span class="summary-sig-arg">text</span>)</span><br />
      Escapes text to be used in an ldap filter.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="ad_ldap.ad_ldap-pysrc.html#Escape">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="ADTimeToUnix"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">ADTimeToUnix</span>(<span class="sig-arg">ad_time</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="ad_ldap.ad_ldap-pysrc.html#ADTimeToUnix">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Converts AD double-wide int format to seconds since the epoch format.

Args:
  ad_time: a 64-bit integer time format used by AD with the number of 100ns
           intervals since January 1, 1601.

Note: cribbed from filetimes.py at http://reliablybroken.com/b/2009/09/

Returns:
  An int with the number of seconds since January 1, 1970.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="TextTimeToUnix"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">TextTimeToUnix</span>(<span class="sig-arg">text_time</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="ad_ldap.ad_ldap-pysrc.html#TextTimeToUnix">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Converts alternate time format text strings to seconds since the epoch.

Some Active Directory properties are stored in a YYYYMMDDHHMMSS.0Z format.
See http://msdn.microsoft.com/en-us/library/aa772189(VS.85).aspx for details.

Args:
  text_time: the string containing the time value.

Returns:
  The number of seconds since the epoch.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="BitmaskBool"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">BitmaskBool</span>(<span class="sig-arg">bitmask</span>,
        <span class="sig-arg">value</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="ad_ldap.ad_ldap-pysrc.html#BitmaskBool">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Returns True or False depending on whether a particular bit has been set.

Microsoft uses bitmasks as a compact way of denoting a number of boolean
settings.  The second bit, for example, might be the ADS_UF_ACCOUNTDISABLE
bit, so if the second bit is a 1, then the account is disabled, and if it is
a 0, then it is not.

As an example, to create the 'disabled' property of a User object, we use the
userAccountControl property and ADS_UF_ACCOUNTDISABLE constant.

BitmaskBool(user.user_account_control, constants.ADS_UF_ACCOUNTDISABLE)
This will return True if the bit is set in user.user_account_control.

Args:
  bitmask: a number representing a bitmask
  value:  the value to be checked (usually a known constant)

Returns:
  True if the bit has been set, False if it has not.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="Escape"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">Escape</span>(<span class="sig-arg">text</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="ad_ldap.ad_ldap-pysrc.html#Escape">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Escapes text to be used in an ldap filter.

Args:
  text: The text to be escaped

Returns:
  The escaped text.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="ad_ldap-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/py-ad-ldap">py-ad-ldap</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Tue Feb 01 17:00:00 2011
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
